SET _travelmode=%1
SET _filename=%2
SET _lats=%3
SET _longs=%4
SET _late=%5
SET _longe=%6
SET _proxy=%3

SET _proxy=###%_proxy%###
SET _proxy=%_proxy:"###=%
SET _proxy=%_proxy:###"=%
SET _proxy=%_proxy:###=%

set http_proxy=%_proxy%
IF %_proxy% == DIRECT set http_proxy=

:: Remove quotes
SET _travelmode=###%_travelmode%###
SET _travelmode=%_travelmode:"###=%
SET _travelmode=%_travelmode:###"=%
SET _travelmode=%_travelmode:###=%

:: Remove quotes
SET _lats=###%_lats%###
SET _lats=%_lats:"###=%
SET _lats=%_lats:###"=%
SET _lats=%_lats:###=%

:: Remove quotes
SET _longs=###%_longs%###
SET _longs=%_longs:"###=%
SET _longs=%_longs:###"=%
SET _longs=%_longs:###=%

:: Remove quotes
SET _late=###%_late%###
SET _late=%_late:"###=%
SET _late=%_late:###"=%
SET _lats=%_lats:###=%

:: Remove quotes
SET _longe=###%_longe%###
SET _longe=%_longe:"###=%
SET _longe=%_longe:###"=%
SET _longe=%_longe:###=%


wget.exe -O %_filename% "http://maps.googleapis.com/maps/api/directions/json?origin=%_lats%,%_longs%&destination=%_late%,%_longe%&sensor=false&mode=%_travelmode%&language=en&units=metric"